package com.myshop.b2b.commonmodule.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author likaiping
 * @createTime 2024/7/2 17:34
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class Result<T>{
    private int code;
    private String msg;
    private T data;
    public static <E> Result<E> success(E data) {
        return new Result<>(200, "操作成功", data);
    }

    //快速返回操作成功响应结果
    public static Result success() {
        return new Result(200, "操作成功", null);
    }
    public static <E> Result<E> success(String message, E data) {
        return new Result<>(200, message, data);
    }

    public static Result error(String message) {
        return new Result(1000, message, null);
    }
}
